package com.wjjun.test.ui

import android.view.View
import androidx.databinding.ViewDataBinding
import com.wjjun.base.ui.activity.BaseBindingActivity
import com.wjjun.app.R
import com.wjjun.test.ui.viewmodel.TestWindowViewModel
import com.wjjun.test.ui.window.TestBtmDialog
import com.wjjun.test.ui.window.TestDialog
import com.wjjun.test.ui.window.TestListDialog
import com.wjjun.test.ui.window.TestWindow
import dagger.hilt.android.AndroidEntryPoint

/**
 * 测试弹窗
 * author : wangjunjun
 * date   : 2022/7/13
 * desc   :
 */
@AndroidEntryPoint
class TestWindowActivity : BaseBindingActivity<TestWindowViewModel, ViewDataBinding>() {

    override fun initContent() {
        setTitle("测试弹窗")
    }

    override fun initParams() {
    }

    override suspend fun fetchData() {

    }

    override fun onClick(view: View) {
        when (view.id) {
            R.id.tv_window -> {
                TestWindow(this).showAsDropDown(view)
            }
            R.id.tv_dialog -> {
                TestDialog(this).show()
            }
            R.id.tv_btm_dialog -> {
                TestBtmDialog(this).apply {
                    setCancelable(true)
                    setCanceledOnTouchOutside(true)
                }.show()
            }
            R.id.tv_list_dialog -> {
                TestListDialog(this).apply {
                    setCancelable(true)
                    setCanceledOnTouchOutside(true)
                }.show()
            }
        }
    }

}